//package top.qitun.event.listener;
//
//import com.google.common.base.Preconditions;
//
//import top.qitun.domain.UserBalanceTcc;
//import top.qitun.event.ReservedBalanceCancellationEvent;
//import top.qitun.service.tcc.UserBalanceTccService;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.ApplicationListener;
//import org.springframework.scheduling.annotation.Async;
//import org.springframework.stereotype.Component;
//import org.springframework.transaction.annotation.Transactional;
//
///**
// * @author Zhao Junjian
// */
//@Component
//public class ReservedBalanceCancellationEventListener implements ApplicationListener<ReservedBalanceCancellationEvent> {
//
//    private final UserBalanceTccService tccService;
//
//    @Autowired
//    public ReservedBalanceCancellationEventListener(UserBalanceTccService tccService) {
//        this.tccService = tccService;
//    }
//
//    @Async
//    @Transactional(rollbackFor = Exception.class)
//    @Override
//    public void onApplicationEvent(ReservedBalanceCancellationEvent event) {
//        Preconditions.checkNotNull(event);
//        final UserBalanceTcc res = (UserBalanceTcc) event.getSource();
//        Preconditions.checkNotNull(res);
//        tccService.cancelReservation(res);
//    }
//
//}
